const form = document.querySelector('form')
const username = document.querySelector("#username");
const pwd = document.querySelector("#pwd");
const rigisterBtn = document.querySelector(".registerbtn");
// console.log(username);
// console.log(pwd);
// console.log(form);
form.addEventListener("submit", e => {

  e = e || window.event

  try { e.preventDefault() } catch(err) { e.returnValue = false }
  
  let name = username.value;
  let password = pwd.value;

  console.log(name);
  console.log(password);

  if (!name || !password) return alert('请完整填写表单')


  window.localStorage.setItem('username',name)
  window.localStorage.setItem('password',password)
  alert('注册成功,即将进入登录页面')
  window.location.href = './login.html'
});
